package kingbase_xorm0

import (
	"xorm.io/core"

	_ "gitee.com/general252/kingbase.com/gokb"
)

func init() {
	regDrvsNDialects()
}

func regDrvsNDialects() bool {
	providedDrvsNDialects := map[string]struct {
		dbType    core.DbType
		getDriver func() core.Driver
	}{
		"kingbase": {
			dbType: "kingbase",
			getDriver: func() core.Driver {
				return &pqDriverPgx{}
			},
		},
	}

	for driverName, v := range providedDrvsNDialects {
		if driver := core.QueryDriver(driverName); driver == nil {
			core.RegisterDriver(driverName, v.getDriver())
			// core.RegisterDialect(v.dbType, v.getDialect) // 使用 xorm v0.7.9/dialect_postgres.go/postgres(struct)
		}
	}
	return true
}
